package com.persondemo.videoappliction.ui.adapter;

import android.content.Context;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.persondemo.videoappliction.R;
import com.persondemo.videoappliction.bean.VipSeachBean;
import com.persondemo.videoappliction.utils.ImageLoaderUtil;

import java.util.List;

/**
 * Created by Administrator on 2018/4/16.
 */

public class SeachVipAdapter extends BaseMultiItemQuickAdapter<VipSeachBean.DataBean, BaseViewHolder> {
    private Context mContext;

    public SeachVipAdapter(List<VipSeachBean.DataBean> data, Context mContext) {
        super(data);
        this.mContext = mContext;
        addItemType(VipSeachBean.DataBean.HAVE_IMG, R.layout.item_seachvip_have);
        addItemType(VipSeachBean.DataBean.NO_IMG, R.layout.item_seachvip);
    }

    @Override
    protected void convert(BaseViewHolder helper, VipSeachBean.DataBean item) {
        switch (helper.getItemViewType()) {
            case VipSeachBean.DataBean.HAVE_IMG:
                helper.setText(R.id.item_seachvip_title,item.getTitle());
                helper.setText(R.id.item_seachvip_have_content,item.getContent());
                helper.setText(R.id.item_seachvip_have_from,item.getLaiyuan());
               helper.addOnClickListener(R.id.item_seachvip_from_text);
                ImageLoaderUtil.LoadImage(mContext,item.getImgs(),helper.getView(R.id.seachvip_have_img));
                break;
            case VipSeachBean.DataBean.NO_IMG:
                helper.setText(R.id.item_seachvip_title,item.getTitle());
                helper.setText(R.id.item_seachvip_content,item.getContent());
                helper.setText(R.id.item_seachvip_from,item.getLaiyuan());
                helper.addOnClickListener(R.id.item_seachvip_from_text02);
                break;
        }
    }
}
